package com.example.hellodemo.recyclerView;

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.StaggeredGridLayoutManager;

import android.icu.lang.UCharacter;
import android.os.Bundle;
import android.text.Layout;
import android.widget.Toast;

import com.example.hellodemo.R;

public class PuRecyclerViewActivity extends AppCompatActivity {
    private RecyclerView puRecyclerView;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_pu_recycler_view);
        puRecyclerView = findViewById(R.id.puRecyclerView);
        puRecyclerView.setLayoutManager(new StaggeredGridLayoutManager(2, RecyclerView.VERTICAL));
        puRecyclerView.setAdapter(new PuRecyclerViewAdapter(PuRecyclerViewActivity.this, new PuRecyclerViewAdapter.ItemOnClick() {
            @Override
            public void onClick(int position) {
                Toast.makeText(PuRecyclerViewActivity.this,"position:" + position,Toast.LENGTH_SHORT).show();
            }
        }));
    }
}
